package com.huitone.smspfm.interfacz.tasks;

import com.huitone.smspfm.context.app.AppManager;
import com.huitone.smspfm.interfacz.core.AppStaticConfigs;

/**   
* @Title CleanExpireSerialsTask.java 
* @Package com.huitone.smspfm.interfacz.tasks 
* @Description 任务:用于清除zset.recv.serials=RptRecvSerialsZSet去重序列过期的元素
* @author ybliang   
* @date 2017年5月28日 下午5:08:41 
* @version V1.0   
*/
public class CleanExpireSerialsTask extends Thread {
	
	private long expireInteval = 86400000; // 毫秒
	
	private long excuteInteval = 60000; // 毫秒

	@Override
	public void run() {
		
		while (!this.isInterrupted() && AppManager.isRunning()) {
			
			long expireTime = System.currentTimeMillis() - expireInteval;
			
			AppStaticConfigs.zsetOpts.removeByScore(AppStaticConfigs.iRptRecvSerialsZSet, 0, expireTime);
			
			try {
				Thread.sleep(excuteInteval);
			} catch (InterruptedException e) {
				break;
			}
		}
	}
}
